package com.own.business.system.user.controller.user.entity.form;

import com.own.component.common.exception.BusinessSimpleException;
import com.own.component.common.util.FormUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * UpdateUserAvatarForm
 *
 * @author chenxueli
 * @date 2024-03-23 21:29:26
 */
@Data
public class UpdateUserAvatarForm implements Serializable {

    @Schema(title = "头像信息")
    private String avatar;

    public void check() {
        if (StringUtils.isBlank(avatar)) {
            throw new BusinessSimpleException("用户头像不能为空");
        }
        if (FormUtil.isUrl(avatar)) {
            throw new BusinessSimpleException("用户头像格式不正确");
        }
    }

}
